<?php
//初始跳转到登陆页面
Route::get('/',function()
{
	return Redirect::to('cms/login');
});
//设置配置页面
Route::get('install', function()
{
	return Redirect::to('config/guidance');
});

Route::group(['prefix'=>'config'],function()
{
	//展示配置数据库连接页面
	Route::get('guidance','SetEnvironmentController@showView');
	//设置数据库连接
	Route::post('setEnvironment','SetEnvironmentController@setEnvironment');
});



Route::group(['prefix'=>'cms'],function()
{
	//登陆信息检测
	Route::post('loginCheck','LoginController@loginCheck');

	//检测是否已经登陆
	Route::group(['before'=>'auth'],function()
	{
		//模型管理
		Route::group(['prefix'=>'model'],function()
		{
			//查询模版所有信息
			Route::get('findAll','ModelController@findAll');
			//根据id查询一条模板信息
			Route::get('findById','ModelController@findById');
			//添加模板
			Route::post('add','ModelController@addModel');
			//删除模板
			Route::post('delete','ModelController@deleteModel');
			//更新模板
			Route::post('update','ModelController@updateModel');

			//字段管理
			Route::group(['prefix'=>'field'],function()
			{
				//查询所有字段
				Route::get('findAll','FieldController@findAll');
				//找出一条字段
				Route::get('findByOne','FieldController@findByOne');
				//增加字段
				Route::post('add','FieldController@addField');
				//修改字段
				Route::post('update','FieldController@updateField');
				//删除字段
				Route::post('delete','FieldController@deleteField');
			});
		});

		//栏目管理
		Route::group(['prefix' => 'category'], function(){
			//栏目列表
			Route::get('index', 'CategoryController@index');
			//添加栏目
			Route::get('add', 'CategoryController@create');
			Route::post('add', 'CategoryController@add');
			//修改栏目
			Route::get('update', 'CategoryController@edit');
			Route::post('update', 'CategoryController@update');
			//删除栏目
			Route::post('delete', 'CategoryController@delete');
		});

		//文档管理
		Route::group(['prefix' => 'document'], function(){
			//文档列表
			Route::get('index', 'DocumentController@index');
			//显示文档详情
			Route::get('show', 'DocumentController@show');
			//增加文档
			Route::get('add', 'DocumentController@create');
			Route::post('add', 'DocumentController@add');
			//修改文档
			Route::get('update', 'DocumentController@edit');
			Route::post('update', 'DocumentController@update');
			//删除文档
			Route::post('delete', 'DocumentController@delete');
		});
	});
});


include(app_path().'/testRoute.php');